<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<jsp:include page="menu.jsp"></jsp:include>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>文件列表</title>
		<link rel="stylesheet" type="text/css" href="css/my.css" />
		<script src="js/jquery-3.7.1.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			body {
   			 	background-image: url("img/background.png");
    			background-size: cover;
    			font-family: "Noto Sans SC", sans-serif;
			}
			.d1 {
				margin: 10px auto;
   				max-width: 1300px;
   				height: 660px;
   				padding-top: 30px;
   				background-color: #FFF8DC;
    			border-radius: 8px;
   				box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
			}
			.longname{
				max-width: 100px;
  				white-space: nowrap;
  				overflow: hidden;
  				text-overflow: ellipsis;
			}
			.show tr:nth-child(even) {
   		 		background-color: #D3D3D3;
			}
			.show a:hover {
 			  	color: #FF0040;
			}
		</style>
	</head>
	<body>
	<c:if test="${empty list }">
		<div style="height: 100px"></div>
		<h1 class="title">未检索到文件，先看看其他类型的文件吧！</h1>
		<input type="hidden" name="state" id="i1" value="">
	</c:if>
	<c:if test="${not empty list }">
		<div style="height: 10px"></div>	
		<h1 class="title">文件列表</h1>
		<div class="d1">	
			<div style="height: 30px"></div>
				<table class="show">
					<tr>
						<th>序号</th>
						<th>分享用户<a href="listsort?key=username&my=0">↑↓</a></th>
						<th>文件名称<a href="listsort?key=filename&my=0">↑↓</a></th>
						<th>文件类型<a href="listsort?key=classification&my=0">↑↓</a></th> 
						<th style="width: 150px;">文件下载</th>
						<th style="width: 150px;">公开时间<a href="listsort?key=releasedate&my=0">↑↓</a></th>
						<th>推荐指数<a href="listsort?key=rating&my=0">↑↓</a></th>
						<th style="width: 200px;">文件描述<a href="listsort?key=description&my=0">↑↓</a></th>
					</tr>
					<c:forEach items="${list}" var="file" varStatus="sta">
							<tr>
							<td>${sta.count}</td>
							<td>${file.username}</td>
							<td class="longname">${file.filename}</td>
							<td>${file.classification}</td>
							<td> 
								<form action="download" method="post">
									<input type="hidden" name="filename" value="${file.filename}">
									<input type="hidden" name="filepath" value="${file.filepath}">
									<input type="submit" value="下载" class="sub2">
								</form>	
							</td>					
							<td>
								<fmt:formatDate value="${file.releasedate}" pattern="yyyy-MM-dd" />
							</td>
							<td>
								<fmt:formatNumber value="${file.rating}" pattern=".00"></fmt:formatNumber>
							</td>
							<td class="longname">${file.description}</td>					
						</tr>
					</c:forEach>
					<tr>
						<td colspan="9">${bar}</td>
					</tr>
					<tr>
						<td colspan="9">
							<form action="category" method="post" class="f3">
								<div>
								每页显示<input type="text" name="num" value="${empty num?10:num}" width="20px">条
								<input type="hidden" name="state" value="1">
								<input type="submit" value="确定" width="20px" class="sub3">
								</div>
							</form>
						</td>
					</tr>
				</table>
			</div>
		</c:if>
	</body>
</html>
